"""
@Author : 合肥一元数智教育科技有限公司
@Date :  2025/2/27 9:09
@Description :  定义一个汽车类  包含 颜色 价格 型号 品牌

通过update_info 函数实现car信息的修改

"""


class Car:
    brand = None
    model = None
    color = None
    price = None

    # def __init__(self, brand, model, color, price):
    #     self.brand = brand
    #     self.model = model
    #     self.color = color
    #     self.price = price

    # 定义函数 update_info实现汽车信息的修改
    def update_info(self,brand, model, color, price):
        self.brand = brand
        self.model = model
        self.color = color
        self.price = price


# 创建car对象
# car1 = Car('BMW', 'AH', 'red', 100)
car1 = Car()
print(car1.brand, car1.model, car1.color, car1.price)
#  修改实例中的属性值
# car1.brand = 'byd'
# car1.color = 'white'
# car1.price = 10
# car1.model = '唐'
# 位置参数
# car1.update_info('byd','唐','white',10)
# 关键词参数
car1.update_info(price=10,model='唐',color='blue',brand='BYD')
print(car1.brand, car1.model, car1.color, car1.price)
